import * as React from 'react';
import classNames from 'classnames';

type ColSpanType = number | string;

export interface ColProps {
	children?: React.ReactNode;
	className?: string;
	span?: ColSpanType;
	order?: ColSpanType;
	offset?: ColSpanType;
}

const Col: React.FC<ColProps> = props => {
	const prefixCls = 'bh-col';
	const {
		children,
		className,
		span,
		order,
		offset,
		...restProps
	} = props;
	const classString = classNames(
		prefixCls,
		className,
		{
			[`${prefixCls}-${span}`]: span !== undefined,
			[`${prefixCls}-order-${order}`]: order,
			[`${prefixCls}-offset-${offset}`]: offset,
		}
	);

	return (
		<div {...restProps} className={classString}>
		    {children}
		</div>
	)
};

export default Col;